<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
     <!--    <div class="layui-form-item ">
            <label class="layui-form-label required">选择店铺</label>
            <div class="layui-input-block">
                <select name="store_id" id="storeId"  lay-filter="buildingFilter" data-select="{:url('management.store/getstore')}" data-fields="store_id,store_name"  ></select>
            </div>
        </div> -->
     
        <div class="layui-form-item">
            <label class="layui-form-label">规格名</label>
            <div class="layui-input-block">
                <input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入规格名" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">规格值</label>
            <div class="layui-input-block flex-row tags" id="tags">
                <input type="text" name="" class="layui-input" placeholder="多个规格值空格生成" id="inputTags">
            </div>
            <input type="hidden" name="content" value="" id="content" lay-verify="required" placeholder="请输入规格值">
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input type="text" name="sort" class="layui-input"  placeholder="请输入排序" value="0">
            </div>
        </div>
    <!--     <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="status" class="layui-input"  value="1" title="启用" checked="">
                <input type="radio" name="status" class="layui-input"  value="0" title="禁用">
            </div>
        </div> -->
        <!-- <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注说明</label>
            <div class="layui-input-block">
                <textarea name="remark" class="layui-textarea"  placeholder="请输入备注说明"></textarea>
            </div>
        </div> -->
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script type="text/javascript">

   layui.config({
        base: '/static/plugs/layui-v2.5.6/lay/modules/',
    }).use(['inputTags'],function(){
        var inputTags = layui.inputTags;
        inputTags.render({
          elem:'#inputTags',//定义输入框input对象
          content: [],//默认标签
          aldaBtn: false,//是否开启获取所有数据的按钮
          done: function(value){ //回车后的回调
          }
        })   
      })
</script>
<script>
    var layer = layui.layer,
        form = layui.form,
        $=layui.jquery,
        upload = layui.upload;
    // 联动
    layui.use('form', function(){
        form.on('select(buildingFilter)', function(data){
            getHousing(data);
        });
    });
    //获取店铺下的分类
    function getHousing(data) {
      
            var params={
                store_id:data.value,
            }
            //检查项目添加到下拉框中
                $.ajax({
                    url:"{:url('management.store_cate/getcate')}",
                    dataType: 'json',
                    data : JSON.stringify(params),
                    contentType: "application/json",  
                    type: 'post',
                    success: function (data) {
                        var html='';
                        $("#cateId").empty();//清空下拉框的值
              
                            // $('#cateId').append(new Option('请选择',0));
                           
                            html+='<option value="0">请选择</option>';
                        $.each(data.data, function (index, item) {
                            html+='<option value="'+item.store_category_id+'" '+(item.level!=3 && item.count!=0 ?"disabled":"")+'>'+item.cate_name+'</option>';
                            // $('#cateId').append(new Option(item.cate_name, item.store_category_id,true,store_category_id>0 && store_category_id==item.store_category_id?true:false));// 下拉菜单里添加元素
                        });
                        $('#cateId').append(html);
                        layui.form.render("select");//重新渲染 固定写法
                    }
                });
    };
    </script>